import { Injectable } from '@angular/core';
import { Observable} from 'rxjs';
import { Http} from '@angular/http';
import {GlobalService} from "../global.service";

@Injectable()
export class ProblemRelatedService {

  constructor(
    private http:Http,
    private globalService:GlobalService,
  ) { }

  getProblemSetsList(data): Observable<any>{
    return this.http.post(this.globalService.api+'/services/core/findProblemSetCategory',data);
  }

  findProblemSetInfos(data): Observable<any>{
    return this.http.post(this.globalService.api+'/services/core/findProblemSetInfos',data);
  }

  getProblemsBySetsCode(data):Observable<any>{
    return this.http.post(this.globalService.api+'/services/core/findProblemSet',data);
  }

  getProblemByCode(data):Observable<any>{
    return this.http.get(this.globalService.api+'/services/core/findProblemSet/'+data);
  }

  saveOriginCode(data):Observable<any>{
    return this.http.post(this.globalService.api+'/services/core/saveJudgeInfo/',data);
  }

  findJudgeInfoByCode(data):Observable<any>{
    return this.http.get(this.globalService.api+'/services/core/findJudgeInfoByCode/'+data.code,{});
  }

  createCategory(data):Observable<any>{
    return this.http.post(this.globalService.api+'/services/core/createCategory',data);
  }

  createSet(data):Observable<any>{
    return this.http.post(this.globalService.api+'/services/core/createSet',data);
  }

  updateSet(data):Observable<any>{
    return this.http.post(this.globalService.api+'/services/core/updateSet',data);
  }

  getSet(data):Observable<any>{
    return this.http.get(this.globalService.api+'/services/core/problemSet/'+data);
  }
}
